//
//  LoadingAnimation.m
//  SoundPill
//
//  Created by 宋旭东 on 15/3/28.
//  Copyright (c) 2015年 宋旭东. All rights reserved.
//

#import "LoadingAnimation.h"

@interface LoadingAnimation ()

@end

@implementation LoadingAnimation
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = [UIColor colorWithWhite:0.000 alpha:0.520];
        self.loadingImage = [[UIImageView alloc] initWithFrame:CGRectMake(self.frame.size.width / 2 - 80, self.frame.size.height / 2 - 80, 160, 160)];
        NSArray *animation = [NSArray arrayWithObjects:[UIImage imageNamed:@"loadingAnimation1"],[UIImage imageNamed:@"loadingAnimation2"], [UIImage imageNamed:@"loadingAnimation3"],[UIImage imageNamed:@"loadingAnimation4"],[UIImage imageNamed:@"loadingAnimation5"],[UIImage imageNamed:@"loadingAnimation6"], [UIImage imageNamed:@"loadingAnimation7"],[UIImage imageNamed:@"loadingAnimation8"],[UIImage imageNamed:@"loadingAnimation9"],[UIImage imageNamed:@"loadingAnimation10"],[UIImage imageNamed:@"loadingAnimation11"],nil];
        _loadingImage.animationImages = animation;
        _loadingImage.animationDuration = 0.7;
        _loadingImage.animationRepeatCount = 6;
//        _loadingImage.image = [UIImage imageNamed:@"loadingAnimation3"];
        [_loadingImage startAnimating];
        [self addSubview:_loadingImage];
        UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, self.frame.size.height / 2 + 20, self.frame.size.width, 40)];
        label.textColor = [UIColor whiteColor];
        label.numberOfLines = 0;
        label.font = [UIFont systemFontOfSize:14];
        label.textAlignment = NSTextAlignmentCenter;
        label.text = @"「声音」与「图片」正在混合，\n继续添加其他元素...";
//        「声音」
        [self addSubview:label];
    }
    return self;
}

- (void)layoutSubviews{
   
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
